<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions">

<ui:composition template="../templates/connoisseur/mainLayout.xhtml" xmlns:sec="http://www.springframework.org/security/tags">
	
	<ui:define name="windowTitle" >
		Rejestracja
	</ui:define>
	
	<ui:define name="moreHeaderScripts">
		<script type="text/javascript" src="../scripts/calendar_locale.js" />	
	</ui:define>
	
	<ui:define name="mainContent" >
		<h:form id="form">
			<h2>Rejestracja</h2>
			<p:messages id="messages" showDetail="true" showSummary="true" closable="true" />
			<h:panelGrid columns="2">
			
				<h:outputLabel id="nameLbl" value="#{msg['registration.name']}" />
				<p:tooltip for="name" value="#{msg['registration.name.description']}" showEffect="fade" hideEffect="fade" />
				<p:inputText id="name" value="#{registerMB.user.name}" required="true" >
					<f:validateLength minimum="2" maximum="30" />
				</p:inputText>
				<p:message for="name" display="both" />

				<h:outputLabel id="surnameLbl" value="#{msg['registration.surname']}" />
				<p:tooltip for="surname" value="#{msg['registration.surname.description']}" showEffect="fade" hideEffect="fade" />
				<p:inputText id="surname" value="#{registerMB.user.surname}" required="true" >
					<f:validateLength minimum="2" maximum="30" />
				</p:inputText>
				<p:message for="surname" display="both" />	
				
				<h:outputLabel id="usernameLbl" value="#{msg['registration.username']}" />
				<p:tooltip for="username" value="#{msg['registration.username.description']}" showEffect="fade" hideEffect="fade" />
				<p:inputText id="username" value="#{registerMB.user.username}" required="true" >
					<f:validateLength minimum="5" maximum="30" />
				</p:inputText>
				<p:message for="username" display="both" />
				
				<h:outputLabel id="passwordLbl" value="#{msg['registration.password']}" />
				<p:tooltip for="password" value="#{msg['registration.password.description']}" showEffect="fade" hideEffect="fade" />
				<p:password id="password" feedback="true" required="true" value="#{registerMB.user.password}" promptLabel="#{msg['registration.password.description']}"
					strongLabel="#{msg['registration.password.strong']}" match="confirmpassword" weakLabel="#{msg['registration.password.weak']}" goodLabel="#{msg['registration.password.good']}" />
				<p:message for="password" display="both" />	
				
				<h:outputLabel id="confirmpasswordLbl" value="#{msg['registration.confirmpassword']}" />
				<p:tooltip for="confirmpassword" value="#{msg['registration.confirmpassword.description']}" showEffect="fade" hideEffect="fade" />
				<p:password id="confirmpassword" feedback="true" required="true" value="#{registerMB.confirmPassword}" promptLabel="#{msg['registration.confirmpassword.description']}"
					strongLabel="#{msg['registration.password.strong']}" weakLabel="#{msg['registration.password.weak']}" goodLabel="#{msg['registration.password.good']}" />
				<p:message for="password" display="both" />
				
				<h:outputLabel id="dateofbirthLbl" value="#{msg['registration.dateofbirth']}" />
				<p:tooltip for="dateofbirth" value="#{msg['registration.dateofbirth.description']}" showEffect="fade" hideEffect="fade" />
				<p:calendar locale="pl" showButtonPanel="true" pattern="dd-MM-yyyy" value="#{registerMB.user.birthDate}" navigator="true" id="dateofbirth"/> 
				<p:message for="dateofbirth" display="both" /> 				
			</h:panelGrid>
			<p:commandButton value="#{msg['registration.submit']}" update="@form" action="#{registerMB.save}" />
			
		</h:form>	
	</ui:define>
	
	<ui:define name="sidebarRight">
		<h4>Dlaczego warto się zarejestrować?</h4>
		<img src="/templates/connoisseur/images/home/1.jpg" width="280" alt=""/>
	</ui:define>
	

</ui:composition>
</html>
